﻿using System.Linq.Expressions;

using Volo.Abp.Domain.Entities;

namespace ApproveFlowEngine.EntityFrameworkCoreSplitTable.AbpCore
{
    public interface ISplitRepository<TEntity> where TEntity : class, IEntity
    {
        #region Public Methods

        Task<long> GetCountAsync(DateTime? begin = null, DateTime? end = null, CancellationToken cancellationToken = default);

        Task<long> GetCountAsync(DateTime current, CancellationToken cancellationToken = default);

        Task<List<TEntity>> GetListAsync(Expression<Func<TEntity, bool>> predicate, DateTime? begin = null, DateTime? end = null, bool includeDetails = false, CancellationToken cancellationToken = default);

        Task<List<TEntity>> GetPagedListAsync<TOrder>(Expression<Func<TEntity, TOrder>> keySelector, int skipCount, int maxResultCount, DateTime? begin = null, DateTime? end = null, bool includeDetails = false, CancellationToken cancellationToken = default);

        Task<List<TEntity>> GetPagedListAsync<TOrder>(Expression<Func<TEntity, bool>> predicate, Expression<Func<TEntity, TOrder>> keySelector, int skipCount, int maxResultCount, DateTime? begin = null, DateTime? end = null, bool includeDetails = false, CancellationToken cancellationToken = default);

        Task<IQueryable<TEntity>> GetQueryableAsync(DateTime current);

        Task<TEntity> InsertAsync(TEntity entity, bool autoSave = false, CancellationToken cancellationToken = default);

        Task InsertManyAsync(IEnumerable<TEntity> entities, bool autoSave = false, CancellationToken cancellationToken = default);

        #endregion Public Methods
    }
}